define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'apply.courseware/index',
        add_url: 'apply.courseware/add',
        edit_url: 'apply.courseware/edit',
        delete_url: 'apply.courseware/delete',
        modify_url: 'apply.courseware/modify',
    };

    var Controller = {

        index: function () {
            
            ea.table.render({
                init: init,
                defaultToolbar:['filter', {
                    title: '搜索',
                    layEvent: 'TABLE_SEARCH',
                    icon: 'layui-icon-search',
                    extend: 'data-table-id="' + 'courseware' + '"'
                }],
                cols: [[
                    {type: "checkbox"},
                    {field: 'title', minWidth: 80, title: '文件名称'},
                    {field: 'create_time', minWidth: 80, title: '创建时间', search: 'range'},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                    }
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        }
    };
    return Controller;
});